home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------
- //
- // Customer.wfm - Mugs Sample Application
- //
- // Data entry from for Customer table.
- //
- // Dependencies: MUGS.CFM
- // MUGS.CC
- // CUSTOMER.DMD
- //
- // Visual dBASE Samples Group
- //
- // $Revision: 1.9 $
- //
- // Copyright (c) 1997, Borland International, Inc.
- // All rights reserved.
- //
- //---------------------------------------------------------------
- SET TALK OFF
- ** END HEADER -- do not remove this line
- //
- // Generated on 10/23/97
- //
- parameter bModal
- local f
- f = new customerForm()
- if (bModal)
- f.mdi = false // ensure not MDI
- f.readModal()
- else
- f.open()
- endif
-
- class customerForm of MUGSDATACFORM from "MUGS.CFM"
- set procedure to MUGS.CC additive
- with (this)
- open = class::FORM_OPEN
- readModal = class::FORM_READMODAL
- onOpen = {;this.book1.entryFirst.setFocus()}
- height = 18
- left = 10
- top = 1
- width = 69
- text = "Customer - Data Entry"
- endwith
-
-
- this.DMCUSTOMER = new DATAMODREF()
- this.DMCUSTOMER.parent = this
- with (this.DMCUSTOMER)
- filename = "customer.dmd"
- dataModClass = "CustomerDataModule"
- share = 0
- active = true
- left = -0.1667
- top = -0.0526
- endwith
-
-
- with (this.BOOK1)
- height = 18
- left = 1
- top = 2.5
- width = 67
- metric = 0
- endwith
-
-
- with (this.BOOK1.GRIDROWS)
-
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset
- metric = 0
- endwith
-
-
- this.BOOK1.LABELNAME = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELNAME)
- height = 1
- left = 2
- top = 3.25
- width = 10
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "Name:"
- endwith
-
-
- this.BOOK1.ENTRYFIRST = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYFIRST)
- height = 1
- left = 12.5
- top = 3.25
- width = 15
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["First Name"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.ENTRYLAST = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYLAST)
- height = 1
- left = 30
- top = 3.25
- width = 15
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Last Name"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.LABELPHONE = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELPHONE)
- height = 1
- left = 2
- top = 4.5
- width = 10
- metric = 0
- alignVertical = 1
- transparent = true
- fontSize = 8
- text = "Phone: "
- endwith
-
-
- this.BOOK1.ENTRYPHONE = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYPHONE)
- height = 1
- left = 12.5
- top = 4.5
- width = 20
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Phone"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.LABELADDRESS = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELADDRESS)
- height = 1
- left = 2
- top = 5.75
- width = 10
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "Address:"
- endwith
-
-
- this.BOOK1.ENTRYSTREET1 = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYSTREET1)
- height = 1
- left = 12.5
- top = 5.75
- width = 45
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Street1"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.ENTRYSTREET2 = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYSTREET2)
- height = 1
- left = 12.5
- top = 7
- width = 45
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Street2"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.LABELCITY = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELCITY)
- height = 1
- left = 2
- top = 8.25
- width = 10
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "City:"
- endwith
-
-
- this.BOOK1.ENTRYCITY = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYCITY)
- height = 1
- left = 12.5
- top = 8.25
- width = 23
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["City"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.LABELSTATE = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELSTATE)
- height = 1
- left = 42
- top = 8.25
- width = 6
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- alignHorizontal = 2
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "State:"
- endwith
-
-
- this.BOOK1.COMBOSTATE = new COMBOSTATE(this.BOOK1)
- with (this.BOOK1.COMBOSTATE)
- height = 1.0909
- left = 50
- top = 8.2727
- width = 7
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["State ID"]
- fontName = "MS Sans Serif"
- fontSize = 8
- style = 1
- endwith
-
-
- this.BOOK1.LABELZIP = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELZIP)
- height = 1
- left = 33
- top = 9.5
- width = 15
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- alignHorizontal = 2
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "Zip/Postal Code:"
- endwith
-
-
- this.BOOK1.ENTRYPOSTAL = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYPOSTAL)
- height = 1
- left = 50
- top = 9.5
- width = 10
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Postal"]
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- validRequired = true
- borderStyle = 7
- endwith
-
-
- this.BOOK1.LABELCOUNTRY = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELCOUNTRY)
- height = 1
- left = 2
- top = 9.5
- width = 10
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- transparent = true
- fontSize = 8
- text = "Country:"
- endwith
-
-
- this.BOOK1.COMBOCOUNTRY = new COMBOBOX(this.BOOK1)
- with (this.BOOK1.COMBOCOUNTRY)
- height = 1.0909
- left = 12.5
- top = 9.5
- width = 18
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Country ID"]
- fontName = "MS Sans Serif"
- fontSize = 8
- style = 1
- endwith
-
-
- this.BOOK1.LABELCOMMENT = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELCOMMENT)
- height = 1
- left = 2
- top = 10.75
- width = 10
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "Comment:"
- endwith
-
-
- this.BOOK1.EDITCOMMENT = new EDITOR(this.BOOK1)
- with (this.BOOK1.EDITCOMMENT)
- height = 3.5
- left = 12.5
- top = 10.75
- width = 52
- metric = 0
- fontName = "MS Sans Serif"
- fontSize = 8
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Comment"]
- cuaTab = true
- endwith
-
-
- this.BOOK1.BUTTONINVOICE = new PUSHBUTTON(this.BOOK1)
- with (this.BOOK1.BUTTONINVOICE)
- onClick = class::BUTTONINVOICE_ONCLICK
- onOpen = {; this.enabled := ( TYPE("form.app") == "O" )}
- height = 1.2
- left = 47.875
- top = 1.8235
- width = 16
- text = "Open Invoice..."
- metric = 0
- fontName = "MS Sans Serif"
- fontSize = 8
- group = true
- colorNormal = "BtnText/BtnFace"
- value = false
- endwith
-
-
- this.BOOK1.LABELID = new TEXT(this.BOOK1)
- with (this.BOOK1.LABELID)
- height = 1
- left = 2
- top = 2
- width = 10
- metric = 0
- colorNormal = "BtnText"
- alignVertical = 1
- transparent = true
- fontName = "MS Sans Serif"
- fontSize = 8
- text = "ID:"
- endwith
-
-
- this.BOOK1.ENTRYID = new ENTRYFIELD(this.BOOK1)
- with (this.BOOK1.ENTRYID)
- enabled = false
- height = 1
- left = 12.5
- top = 2
- width = 9.5
- metric = 0
- dataLink = parent.parent.DMCUSTOMER.ref.customer1.rowset.fields["Customer ID"]
- picture = "99999999"
- colorHighLight = ""
- fontName = "MS Sans Serif"
- fontSize = 8
- borderStyle = 7
- endwith
-
-
- this.BOOK1.BUTTONOK = new PUSHBUTTON(this.BOOK1)
- with (this.BOOK1.BUTTONOK)
- onClick = class::BUTTONOK_ONCLICK
- visible = false
- height = 1.1818
- left = 52.8571
- top = 1.9545
- width = 12
- text = "OK"
- metric = 0
- fontName = "MS Sans Serif"
- fontSize = 8
- group = true
- colorNormal = "BtnText/BtnFace"
- value = false
- endwith
-
-
- this.BOOK1.BUTTONCANCEL = new PUSHBUTTON(this.BOOK1)
- with (this.BOOK1.BUTTONCANCEL)
- onClick = class::BUTTONCANCEL_ONCLICK
- visible = false
- height = 1.1818
- left = 52.8571
- top = 3.4545
- width = 12
- text = "Cancel"
- metric = 0
- fontName = "MS Sans Serif"
- fontSize = 8
- group = true
- colorNormal = "BtnText/BtnFace"
- value = false
- endwith
-
-
- this.rowset = this.DMCUSTOMER.ref.customer1.rowset
-
- // {Linked Method} form.open
- function Form_open()
- class::prepareForm()
- return ( SUPER::Form_open() )
-
- function prepareForm
- this.title.text := "<h2>Customer</h2>"
- return ( this.book1.ENTRYFIRST.setFocus() )
-
- // {Linked Method} form.book1.buttoncancel.onClick
- function BUTTONCANCEL_OnClick
- this.form.rowset.abandon()
- this.form.newID := null
- this.form.canClose := {||true}
- return ( this.form.close() )
-
- // {Linked Method} form.book1.buttoninvoice.onClick
- function BUTTONINVOICE_OnClick
- local nCustomerID
- nCustomerID = this.form.rowset.fields["Customer ID"].value
- return ( this.form.app.OpenInvoiceOpenDialog( nCustomerID ) )
-
- // {Linked Method} form.book1.buttonok.onClick
- function BUTTONOK_OnClick
- local bClose
- bClose = false
- if ( this.form.rowset.fields["Last Name"].value == null and ;
- this.form.rowset.fields["First Name"].value == null )
- MSGBOX("Cannot save customer with blank first and last name",;
- "Alert",48)
- else
- this.form.rowset.save()
- this.form.newID := this.form.rowset.fields["Customer ID"].value
- this.form.canClose := {||true}
- bClose := this.form.close()
- endif
- return ( bClose )
-
- // {Linked Method} form.readModal
- function Form_readModal
- // opened as dialog
- // turn off table view and invoice button.
- // turn on OK and Cancel buttons
- this.newID = null
- this.canClose := {||false}
- with ( this.book1 )
- dataSource := "ARRAY {'Append'}"
- tabstop := false
- buttonInvoice.visible := false
- buttonOK.visible := true
- buttonCancel.visible := true
- endwith
- class::prepareForm()
- super::Form_OnSize( 0, this.width, this.height )
- return ( CUSTOMERFORM::READMODAL() )
- endclass
-